﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<HYBYSoft.Company.Models.QuestionAndReplyMessages>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Details
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $("#replymessage").click(function () {
                if ($("#replyContents").val() == "") {
                    alert('回复内容不能为空！');
                    return false;
                }
            });
        });
    </script>
    <div style="margin-left: 8px; width: 950px">
        <div>
            问题标题：
            <%:Model.Titles %>
        </div>
        <div>
            <%var grid = new WebGrid(source: Model.ReplyMessages,defaultSort: "CreateTime", canPage: false, canSort: false);%>
            <%=grid.GetHtml(tableStyle: "grid", headerStyle: "header", footerStyle: "footer", rowStyle: "row", alternatingRowStyle: "alt", 
                            columns:grid.Columns(grid.Column(format: (item) => Html.Encode(((ReplyMessage)((WebGridRow)item).Value).IsAdmin == 1 ? "管理员回复：" : "游客提问："), style: "isadmincolumn"),
                            grid.Column("Contents", "内容", style: "verticalaligntop"),
                            grid.Column("CreateTime", "创建时间", style: "timecolumn")
            ))%>
        </div>
        <div>
            <% using (Html.BeginForm("Reply", "Message"))
               { %>
            <%:Html.HiddenFor(model=>model.QuestionID) %>
            <div style="float: left; height: 100px; width: 945px;">
                <%= Html.TextArea("replyContents", new { style = "width:943px;height:50px;" })%>
                <p id="button" style="float: right;">
                    <input id="replymessage" type="submit" value="回复" />
                </p>
            </div>
            <% }%>
        </div>
    </div>
</asp:Content>
